<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
    <%
        response.setHeader("Pragma", "No-cache");
        response.setHeader("Cache-Control", "no-cache");
        response.setHeader("Expires", "0");
    %>
    <title>风尚中国后台管理</title>
    <link rel="stylesheet" type="text/css" href="/js/easyui/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="/js/easyui/themes/icon.css">
    <script type="text/javascript" src="/js/easyui/jquery-1.7.1.min.js"></script>
    <script type="text/javascript" src="/js/easyui/jquery.easyui.min.js"></script>

    <script type="text/javascript">
        function addTab(title, href) {
            var tt = $('#main-center');
            if (tt.tabs('exists', title)) {
                tt.tabs('select', title);
            } else {
                var content;
                if (href) {
                    content = '<iframe scrolling="yes" frameborder="0"  src="' + href + '" style="width:100%;height:100%;"></iframe>';
                } else {
                    content = '未实现，开发中！';
                }

                tt.tabs('add', {
                    title:title,
                    closable:true,
                    content:content
                });
            }
        }

        function openPasswordWindow() {
            $('#userForm').form('clear');

            $('#itemEditorDialog').show();
            $('#itemEditorDialog').dialog({
                title:'修改密码',
                modal:true
            });
        }

        function closeForm() {
            $('#userForm').form('clear');
            $('#itemEditorDialog').dialog('close');
        }

        function changePassword() {
            $("#userForm").form('submit', {
                url:"/management/changePassword.action",
                onSubmit:function () {
                    return $(this).form('validate');
                },
                success:function (data) {
                    data = eval('(' + data + ')');

                    if (!data.successful) {
                        alert('更新失败');
                        return;
                    }

                    $.messager.show({
                        title:'提示信息',
                        msg:'新密码保存成功！'
                    });

                    closeForm();
                }
            });
        }
    </script>
    <style type="text/css">
        a {
            TEXT-DECORATION: none
        }
    </style>
</head>
<body class="easyui-layout">
<div region="north" border="false" style="height:60px;background:#B3DFDA;" align="center">
    <div align="center" style="font-size: 14px;height: 40px; line-height:40px; ">风尚中国后台管理</div>
    <div align="right" style="font-size: 12px;height: 20px; line-height:20px; ">
        欢迎你：${_login_user_.displayName}&nbsp;&nbsp;&nbsp;
        <a href="/management/logout.action">退出</a>&nbsp;&nbsp;&nbsp;
        <a href="#" onclick="openPasswordWindow()">修改密码</a>&nbsp;&nbsp;&nbsp;
    </div>
</div>
<div region="west" split="true" title="管理菜单" style="width:180px;padding:0px;">
    <div id="menu" class="easyui-accordion" fit="true">
        <div title="新闻管理" iconCls="icon-ok" selected="true" style="overflow:auto;padding:10px;">
            <div class="nav-item">
                <a href="javascript:addTab('新闻发布管理','/management/news/newsManagementIndex.action')"
                   class="easyui-linkbutton">
                    新闻发布管理
                </a>
            </div>
            <br/>
            <s:if test="1 == #session._user_role_ || 2 == #session._user_role_">
                <div class="nav-item">
                    <a href="javascript:addTab('新闻草稿管理','/management/news/newsDraftIndex.action')"
                       class="easyui-linkbutton">
                        新闻草稿管理
                    </a>
                </div>
                <br/>
            <div class="nav-item">
                <a href="javascript:addTab('新闻内联管理','/management/news/inLineNews.action')" class="easyui-linkbutton">
                    新闻内联管理
                </a>
            </div>
            <br/>

            <div class="nav-item">
                <a href="javascript:addTab('推荐新闻管理','/management/news/manageTopNews.action')" class="easyui-linkbutton">
                    推荐新闻管理
                </a>
            </div>
            <br/>
            <div class="nav-item">
                <a href="javascript:addTab('标签云管理','/tagcloud/cloudIndex.action')" class="easyui-linkbutton">
                    标签云管理
                </a>
            </div>
            <br/>
            <div class="nav-item">
                <a href="javascript:addTab('视频管理','/management/video/videoIndex.action')"
                   class="easyui-linkbutton">
                    视频广告管理
                </a>
            </div>
            </s:if>
        </div>
        <s:if test="#session._user_role_ == 1">
            <div title="栏目管理" iconCls="icon-ok" style="padding:10px;">
                <div class="nav-item">
                    <a href="javascript:addTab('栏目管理','/management/columnsIndex.action')" class="easyui-linkbutton">
                        栏目管理
                    </a>
                </div>
            </div>
        </s:if>
        <s:if test="#session._user_role_ == 1 || #session._user_role_ == 0 || #session._user_role_ == 2 || #session._user_role_ == 3">
        <div title="新闻采集管理" iconCls="icon-ok" style="padding:10px;">
                <div class="nav-item">
                    <a href="javascript:addTab('已采集新闻','/management/news/collectedNewsIndex.action')"
                       class="easyui-linkbutton">
                        已采集新闻
                    </a>
                </div>
                <br/>
            <s:if test="#session._user_role_ == 1 || #session._user_role_ == 2">
            <div class="nav-item">
                    <a href="javascript:addTab('新闻采集源','/management/news/newsSourceIndex.action')" class="easyui-linkbutton">
                        新闻采集源
                    </a>
                </div>
            </s:if>
        </div>
        </s:if>
        <s:if test="#session._user_role_ == 1 || #session._user_role_ == 0 || #session._user_role_ == 2">
        <div title="图库管理" iconCls="icon-ok" style="padding:10px;">
            <div class="nav-item">
                <a href="javascript:addTab('图库管理','/management/gallery/gallery_index.action')"
                   class="easyui-linkbutton">
                    图库管理
                </a>
            </div>
        </div>
        <div title="品牌库管理" iconCls="icon-ok" style="padding:10px;">
            <div class="nav-item">
                <a href="javascript:addTab('品牌库管理','/management/brand/brand_index.action')"
                   class="easyui-linkbutton">
                    品牌库管理
                </a>
            </div>
        </div>
        <div title="人物库管理" iconCls="icon-ok" style="padding:10px;">
            <div class="nav-item">
                <a href="javascript:addTab('人物库管理','/management/person/person_index.action')"
                   class="easyui-linkbutton">
                    人物库管理
                </a>
            </div>
        </div>
        </s:if>
        <s:if test="#session._user_role_ == 1">
            <div title="用户管理" iconCls="icon-ok" style="padding:10px;">
                <div class="nav-item">
                    <a href="javascript:addTab('用户管理','/management/userAdminManagement.action')"
                       class="easyui-linkbutton">
                        用户管理
                    </a>
                </div>
            </div>
            <div title="日志管理" iconCls="icon-ok" style="padding:10px;">
                <div class="nav-item">
                    <a href="/management/quartzLog.action"
                       class="easyui-linkbutton">
                        QuartzLog
                    </a>
                </div>
                <br/>
                <div class="nav-item">
                    <a href="/management/errorLog.action"
                       class="easyui-linkbutton">
                        ErrorLog
                    </a>
                </div>
            </div>
        </s:if>
    </div>
</div>
<%--<div region="south" border="false" style="height:50px;background:#A9FACD;padding:10px;" align="center"><span>Copyright C 2009-2011 .All Rights Reserved. 技术支持：风尚中国</span></div>--%>
<div region="center">
    <div id="main-center" class="easyui-tabs" fit="true" border="false"/>
</div>
<div id="itemEditorDialog" icon="icon-save" title="用户管理" style="height:140;width:280;display:none;padding:5px;">
    <form method="post" id="userForm" name="userForm">
        <table>
            <tr>
                <td><label>新密码：</label></td>
                <td><input class="easyui-validatebox" id="password" type="password" name="password"
                           required="true"/></td>
            </tr>
        </table>
        <div class="toolbar" style="padding:10px;">
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <a href="#" onclick="changePassword()" class="easyui-linkbutton" iconCls="icon-ok">确定</a>
            <a href="#" onclick="closeForm()" class="easyui-linkbutton" iconCls="icon-cancel">取消</a>
        </div>
    </form>
</div>
</body>
</html>